import java.util.Arrays;
import java.util.Scanner;

public class Test01 {
    private static final int[][][] ledDis = {
            {
                    {0, 0, 0, 0},
                    {0, 1, 1, 0},
                    {0, 1, 1, 0},
                    {0, 1, 1, 0},
                    {0, 0, 0, 0}
            },// 0
            {
                    {1, 1, 0, 0},
                    {1, 1, 1, 0},
                    {1, 1, 1, 0},
                    {1, 1, 1, 0},
                    {1, 1, 1, 0}
            },
            {
                    {0, 0, 0, 0},
                    {1, 1, 1, 0},
                    {0, 0, 0, 0},
                    {0, 1, 1, 1},
                    {0, 0, 0, 0}
            },
            {
                    {0, 0, 0, 0},
                    {1, 1, 1, 0},
                    {0, 0, 0, 0},
                    {1, 1, 1, 0},
                    {0, 0, 0, 0}
            },
            {
                    {0, 1, 0, 1},
                    {0, 1, 0, 1},
                    {0, 0, 0, 0},
                    {1, 1, 0, 1},
                    {1, 1, 0, 1}
            },
            {
                    {0, 0, 0, 0},
                    {0, 1, 1, 1},
                    {0, 0, 0, 0},
                    {1, 1, 1, 0},
                    {0, 0, 0, 0}
            },
            {
                    {0, 0, 0, 0},
                    {0, 1, 1, 1},
                    {0, 0, 0, 0},
                    {0, 1, 1, 0},
                    {0, 0, 0, 0}
            },
            {
                    {0, 0, 0, 0},
                    {1, 1, 1, 0},
                    {1, 1, 1, 0},
                    {1, 1, 1, 0},
                    {1, 1, 1, 0}
            },
            {
                    {0, 0, 0, 0},
                    {0, 1, 1, 0},
                    {0, 0, 0, 0},
                    {0, 1, 1, 0},
                    {0, 0, 0, 0}
            },
            {
                    {0, 0, 0, 0},
                    {0, 1, 1, 0},
                    {0, 0, 0, 0},
                    {1, 1, 1, 0},
                    {0, 0, 0, 0}
            }
    };

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        while (T-- > 0){
            int n = in.nextInt();
            int x = in.nextInt();
            int y = in.nextInt();
            String s = in.next();

            int[][] led = new int[5][4];
            boolean[][] state = new boolean[5][4];


            for (int i = 0; i < n; i++) {
                char c = s.charAt(i);
                int[][] display = ledDis[c - '0'];
                if(i == 0){
                    for (int row = 0; row < 5; row++) {
                        for (int col = 0; col < 4; col++) {
                            if(display[row][col] == 1){
                                state[row][col] = false;
                            }else if(display[row][col] == 0 ){
                                state[row][col] = true;
                            }
                        }
                    }
                }else{
                    for (int row = 0; row < 5; row++) {
                        for (int col = 0; col < 4; col++) {
                            if(display[row][col] == 1 && state[row][col] == true){
                                led[row][col]++;
                                state[row][col] = false;
                            }else if(display[row][col] == 0 && state[row][col] == false){
                                led[row][col]++;
                                state[row][col] = true;
                            }
                        }
                    }
                }

            }
            System.out.println(led[x-1][y-1]);
        }
    }
}
